package com.jnks.controller;


import com.jnks.constant.R;
import com.jnks.pojo.domain.vo.*;
import com.jnks.service.BaseInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 设备管理
 *
 * @author Ryo
 * @since 2024-04-12
 */
@Slf4j
@RestController
@RequestMapping("/vehicle/base")
@RequiredArgsConstructor
public class BaseInfoController {

    @Autowired
    private BaseInfoService baseInfoService;


    /**
     * 设备列表
     */
    @GetMapping(value = "/listAllDevice")
    public R listAllDevice() {
        return R.data(baseInfoService.listAllDevice());
    }

    /**
     * 设备修改
     */
    @GetMapping(value = "/deviceUpdate")
    public R deviceUpdate(@RequestBody OneArmedzoneDeviceResponseVo requestVos) {
        return baseInfoService.deviceUpdate(requestVos);
    }

    /**
     * 获取定向设备的水平角
     *
     * @param requestVos
     * @return
     */
    @PostMapping("/deviceAngle")
    public R deviceAngle(@RequestBody DeviceAngleRequestVo requestVos) {
        return R.data(baseInfoService.deviceAngle(requestVos));
    }

    /**
     * 设备经纬度
     *
     * @param deviceId
     * @return
     */
    @GetMapping(value = "/getDeviceLoc/{deviceId}")
    public R getDeviceLoc(@PathVariable(value = "deviceId") Integer deviceId) {
        return R.data(baseInfoService.getDeviceLoc(deviceId));
    }

    /**
     * 反制设备调用
     * @param vo
     * @return
     */
    @PostMapping("/strike")
    public R callDevice(@RequestBody CallDeviceRequsetVo vo) {
        return baseInfoService.strike(vo);
    }

    /**
     * 手动指引
     */
    @PostMapping("/auto")
    public R callDevice(@RequestBody NewDroneReportVO vo) {

        return baseInfoService.auto(vo);

    }

    /**
     * 开关定向不允许追踪
     */
    @PostMapping("/openTrace")
    public R openTrace(@RequestBody TrackVO vo) {


        return baseInfoService.openTrace(vo);

    }

}
